package polarizedMF;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Step4_Ordinal_NonPositiveTestSet {

	/**
	 * @param args
	 */	
	public Step4_Ordinal_NonPositiveTestSet(String svm_dataset, String fold, String epsilon) throws IOException {
		
		BufferedReader br = new BufferedReader(new FileReader(svm_dataset+"fold-"+fold+"\\output0"+epsilon+""));		
		BufferedReader br2 = new BufferedReader(new FileReader(svm_dataset+"fold-"+fold+"\\test0"+epsilon+"_"));		
		BufferedWriter bw = new BufferedWriter(new FileWriter(svm_dataset+"fold-"+fold+"\\test0"+epsilon+"-2"));
		
//		int numRows = 184454;
		
		int lineNum = 0;		
		int numPos = 0;
		int numNonPos = 0;
		
		String line;
		while((line = br.readLine()) != null) {
			double cls = Math.signum(Double.parseDouble(line));
			line = br2.readLine();
			if(cls < 0.0) {
				numNonPos++;
				bw.write(line+"\n");
			}
			else {
				numPos++;
			}
			lineNum++;
		}
		
		br.close();
		
		br2.close();
		
		bw.close();
		
		System.out.println("Number of pos " + numPos);
		System.out.println("Number of non-pos " + numNonPos);
		System.out.println("Total " + (numPos+numNonPos));
	}

}
